#!/bin/bash
#SBATCH --job-name=004100
#SBATCH --output=/hkfs/work/workspace/scratch/bg5912-mysims/GP300/proton/run01/sim_storage//log//8.0/_log%j.out
#SBATCH --error=/hkfs/work/workspace/scratch/bg5912-mysims/GP300/proton/run01/sim_storage//log//8.0/_log%j.err
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=76
#SBATCH --cpus-per-task=1
#SBATCH --time=2-00:00:00

# Load MPI module (if necessary)
# module load mpi
# Set the path to your MPI-Corsika executable
MPI_CORSIKA_EXEC='/home/hk-project-radiohfi/bg5912/work/soft/corsika-77420/run///mpi_corsika77420Linux_SIBYLL_urqmd_thin_coreas_parallel_runner'

# Set the path to your input and output files
INPUT_FILE='/hkfs/work/workspace/scratch/bg5912-mysims/GP300/proton/run01/sim_storage//inp//8.0/SIM004100.inp'
LOG_FILE='/hkfs/work/workspace/scratch/bg5912-mysims/GP300/proton/run01/sim_storage//log//8.0/DAT004100.log'

echo ======================= Conjuring Cosmic Showers  ====================== 
echo starting job number 004100 
echo time: $(date)
# Run the MPI-Corsika executable
mpirun --bind-to core:overload-allowed --map-by core -report-bindings -np $SLURM_NTASKS $MPI_CORSIKA_EXEC $INPUT_FILE > $LOG_FILE

echo job number 004100 complete
echo time: $(date)
echo - - - - - - - - - - - - - - Cleansing Cauldron - - - - - - - - - - - - -
mkdir /hkfs/work/workspace/scratch/bg5912-mysims/GP300/proton/run01/sim_storage//inp//8.0/DAT004100/
echo created /hkfs/work/workspace/scratch/bg5912-mysims/GP300/proton/run01/sim_storage//inp//8.0/DAT004100/
echo moving binaries and corsika_timetables to /hkfs/work/workspace/scratch/bg5912-mysims/GP300/proton/run01/sim_storage//inp//8.0/DAT004100/
mv /hkfs/work/workspace/scratch/bg5912-mysims/GP300/proton/run01/sim_storage//inp//8.0//DAT??????-* /hkfs/work/workspace/scratch/bg5912-mysims/GP300/proton/run01/sim_storage//inp//8.0/DAT004100/
mv /hkfs/work/workspace/scratch/bg5912-mysims/GP300/proton/run01/sim_storage//inp//8.0//corsika_timetable-* /hkfs/work/workspace/scratch/bg5912-mysims/GP300/proton/run01/sim_storage//inp//8.0/DAT004100/
echo =================== Enchantment Successfully Executed ==================
